﻿using Hallenberg.SmartClient.MVC;
using System;
using System.Web.Mvc;
using Hallenberg.SmartClient.MVC.Test.Fakes;
using System.Web.Routing;
using System.Web;
using NUnit.Framework;

namespace Hallenberg.SmartClient.MVC.Test
{
    [TestFixture]
    public class ControllerFactoryExTest
    {
        [Test]
        public void SmartClient_MVC_GetControllerInstanceTest()
        {
            ///////////////////////////////////////////////////////////////////
            // Creating a fake MVC Smart Client Application as well as
            // mocking the RequestContext in order to mimic RouteData.
            ///////////////////////////////////////////////////////////////////

            MvcSmartClientApplication application = new Fakes.TestApplication();
            application.Application_Start();

            RouteData routeData = new RouteData();
            routeData.Values.Add("action", "Index");
                        
            RequestContext reqContext = new RequestContext(new Fakes.HttpContextBaseLight(), routeData);
            ControllerFactoryEx target = new ControllerFactoryEx() { RequestContext = reqContext };

            IController actual = target.GetControllerInstanceTest(typeof(Fakes.CustomersController));

            Assert.IsNotNull(actual);
        }

        /// <summary>
        ///A test for ControllerFactoryEx Constructor
        ///</summary>
        [Test]
        public void SmartClient_MVC_ControllerFactoryExConstructorTest()
        {
            ControllerFactoryEx target = new ControllerFactoryEx();
        }
    }
}
